import sys 
import os.path

from aria_tests import make_element_test, make_group_index_file, make_all_index_file

from role_test_tests     import test_tests
from role_checkbox_tests import checkbox_tests
from role_button_tests   import button_tests
from role_slider_tests   import make_slider_test, slider_tests
from role_menubar_tests  import make_menubar_test, menubar_tests

# Make checkbox tests
i = 1
group = 0
group_files = []
path = "test/"
for test in test_tests:
   num = str(group).zfill(3) + "_" + str(i).zfill(3)
   role = test['role'] 
   id = "test_" + num
   title = "Test " + str(group) + "." + str(i) + " for role " + role
   fname = role + "_" + num
   result_file = make_element_test( group, id, title, path, fname, test )
   group_files.append(result_file)
   i += 1
make_group_index_file( path, group_files, group, "ARIA Test Tests" )



all_files = []

# Make checkbox tests
i = 1
group = 1
group_files = []
path = "checkbox/"
for test in checkbox_tests:
   num = str(group).zfill(3) + "_" + str(i).zfill(3)
   role = test['role'] 
   id = "test_" + num
   title = "Test " + str(group) + "." + str(i) + " for role " + role
   fname = role + "_" + num
   result_file = make_element_test( group, id, title, path, fname, test )
   group_files.append(result_file)
   all_files.append(path+result_file)
   i += 1

group_file = make_group_index_file( path, group_files, group, "ARIA Role Checkbox Tests" )
all_files.append(group_file)

# Make button tests
i = 1
group = 2
group_files = []
path = "button/"
for test in button_tests:
   num = str(group).zfill(3) + "_" + str(i).zfill(3)
   role = test['role'] 
   id = "test_" + num
   title = "Test "+ str(group) + "." + str(i) + " for role " + role
   fname = role + "_" + num
   result_file = make_element_test( group, id, title, path, fname, test )
   group_files.append(result_file)
   all_files.append(path+result_file)
   i += 1

group_file = make_group_index_file( path, group_files, group, "ARIA Role Button Tests" )
all_files.append(group_file)

# Make slider tests
i = 1
group = 3
group_files = []
path = "slider/"
for test in slider_tests:
   num = str(group).zfill(3) + "_" + str(i).zfill(3)
   role = 'slider' 
   id = "test_" + num
   title = "Test "+ str(group) + "." + str(i) + " for role " + role
   fname = role + "_" + num
   result_file = make_slider_test( group, id, title, path, fname, test )
   group_files.append(result_file)
   all_files.append(path+result_file)
   i += 1
   
group_file = make_group_index_file( path, group_files, group, "ARIA Role Slider Tests" )
all_files.append(group_file)

# Make menubar tests
i = 1
group = 4
group_files = []
path = "menubar/"
for test in menubar_tests:
   num = str(group).zfill(3) + "_" + str(i).zfill(3)
   role = 'menubar' 
   id = "test_" + num
   title = "Test "+ str(group) + "." + str(i) + " for role " + role
   fname = role + "_" + num
   result_file = make_menubar_test( group, id, title, path, fname, test )
   group_files.append(result_file)
   all_files.append(path+result_file)
   i += 1
   
group_file = make_group_index_file( path, group_files, group, "ARIA Role Menubar, Menu, MenuItem... Tests" )
all_files.append(group_file)

# Make master index file
make_all_index_file( all_files, "All ARIA Test Results" )
  
  


